const path = require('path')
const systemController = {};
const viewsDir = path.join(path.dirname(__dirname), 'views')
const query = require('../model/query.js')
systemController.system = (req, res) => {
    res.render(`system.html`)
}
systemController.updSystemData = async(req,res)=>{
    let {id,title}=req.body;
    let photo = '';
    let sql = '';
    sql = `update system set title='${title},${photo}where id =${id}`
    const {
        affectedRows
    } = await query(sql)
    if (affectedRows > 0) {
        res.json({
            code: 0,
            message: "编辑成功"
        })
    } else {
        res.json({
            code: -10,
            message: "编辑失败"
        })
    }
}
module.exports = systemController;